package com.k.demo.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.k.demo.entity.PowerDistribution;

@Mapper
public interface PowerDistributionMapper {
	
	List<PowerDistribution> selectAllByUserId(int user_id);
	
	int insert(@Param("user_id")int user_id,@Param("power_id")int power_id);
	
	int delete(@Param("user_id")int user_id,@Param("power_id")int power_id);
	
	List<PowerDistribution> selectAllByPowerId(int power_id);
	
	List<PowerDistribution> selectByUserIdInList(List<Integer> user_id);
	
	@Select("select user_id from power_distribution")
	List<Integer> selectAllUserId();
	//删除用户所有权限
	@Update("update power_distribution set is_delete=0 where user_id=#{user_id} and is_delete=1")
	int deleteUserPower(int user_id);
}
